<?php
// Returns the tweet's attachments.
session_start();
require_once('../twitterlib/twitteroauth/twitteroauth.php');
require_once('../config.php');
require_once('../SQLfunc.php');
require_once('../func.php');

$auth=array();
$gotcha = getAuth($auth);
if(!$gotcha)
{
	die("No token/token secret");
}

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $auth['token'], $auth['token_secret']);
$result = $connection->get('statuses/show', array( 'id' => $_GET['tid'] ));
$text = $result->text;

$resources = array();
$res = parseResources($text, $resources);

if(!$res)
{
	echo "<div class='preview'>No resources found.</div>";
}
else
{
	$n = 0;
	foreach($resources as $r)
	{
		$n = $n + 1;
		?>
        <div class="preview">
            	<div class="pcon">
                    <a href="<? echo $r['../url']; ?>" class="pclink" target="_blank">Original source</a>
                    <a href="javascript:void()" class="pclink" id="col<? echo $n; ?>" onclick="collap(<? echo $n; ?>)">Hide</a>
                </div>
            	<div class="prcont" id="prc<? echo $n; ?>">
                	<? echo $r['code']; ?>
                </div>
            </div>
          <? }
}
?>

